import java.io.*;
import java.util.*;

import be.vdab.personeel.*;
import be.vdab.personeel.kader.*;
import be.vdab.util.*;


public class ZusterBedrijf {


	public static void main(String[] args) throws IOException {
		
		SortedSet<Werknemer> werknemers = new TreeSet<Werknemer>();
		
		File file = new File("h:\\werknemers.dat");
		FileInputStream fis = new FileInputStream(file);
		ObjectInputStream ois = new ObjectInputStream(fis);
		try{
		System.out.println("\n***** uitlezen van werknemers \n");
		
			Object obj = null;
			while((obj = ois.readObject()) !=null){
				if (obj instanceof Werknemer){
					//System.out.println(obj);
					werknemers.add((Werknemer) obj);
				}
			}
		}catch (EOFException e){
			
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{	
			
		ois.close();
		}
		
		Iterator<Werknemer> ti = werknemers.iterator();
		while(ti.hasNext()){
			System.out.println(ti.next());
		}
		
		System.out.println("\n**********************");

	}

}
